package lesson01;

import java.io.File;
import java.io.IOException;

public class Demo_103 {
    public static void main(String[] args) throws IOException {
        File file = new File("D:/temp/test/hello.txt");

        System.out.println(file.getParent());  //文件中的父路径
        System.out.println(file.getName());    //文件名
        System.out.println(file.getPath());    //文件路径
        System.out.println(file.getAbsolutePath());  //绝对路径
        System.out.println(file.getCanonicalPath()); //标准形式的路径


        System.out.println("==================");
        File file1 = new File("./hello.txt");
        System.out.println(file1.getParent());
        System.out.println(file1.getName());
        System.out.println(file1.getPath());
        System.out.println(file1.getAbsolutePath());
        System.out.println(file1.getCanonicalPath());

        System.out.println("==================");
        File file2 = new File("hello.txt");
        System.out.println(file2.getParent());
        System.out.println(file2.getName());
        System.out.println(file2.getPath());
        System.out.println(file2.getAbsolutePath());
        System.out.println(file2.getCanonicalPath());
    }
}
